package boun.swe.bob.entities;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * This entity is used for friend requests relationships
 */
public class FriendRequestPK implements Serializable{

    private Integer requestingUserId;
    private Integer requestedUserId;

    public Integer getRequestingUserId() {
        return requestingUserId;
    }

    public void setRequestingUserId(Integer requestingUserId) {
        this.requestingUserId = requestingUserId;
    }

    public Integer getRequestedUserId() {
        return requestedUserId;
    }

    public void setRequestedUserId(Integer requestedUserId) {
        this.requestedUserId = requestedUserId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FriendRequestPK that = (FriendRequestPK) o;

        if (requestedUserId != null ? !requestedUserId.equals(that.requestedUserId) : that.requestedUserId != null)
            return false;
        if (requestingUserId != null ? !requestingUserId.equals(that.requestingUserId) : that.requestingUserId != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = requestingUserId != null ? requestingUserId.hashCode() : 0;
        result = 31 * result + (requestedUserId != null ? requestedUserId.hashCode() : 0);
        return result;
    }
}
